/**
 * 1.属性的默认值:defaultProps
 * 2.属性的json数据
 * */
import {
  createInbizSchema,
  createComponentStyleSchema,
  createDecoratorStyleSchema,
} from '@inbiz/setters';
import { ProcessLogBtn as LocaleProcessLogBtn } from './locale';

export const defaultProps = {
  minWidth: 100,
  maxWidth: '',
  text: 'button',
  type: 'primary',
  processQueryData: {
    instanceId: '',
    processId: '',
  },
};

export const propsSchema = createInbizSchema({
  attribute: {
    base: {
      type: 'void',
      'x-component': 'CollapseItem',
      properties: {
        'x-display': {
          type: 'string',
          enum: ['visible', 'hidden'],
          'x-decorator': 'FormItem',
          'x-component': 'Select',
          'x-component-props': {
            defaultValue: 'visible',
          },
        },
      },
    },
  },
  style: {
    ...createComponentStyleSchema(),
    ...createDecoratorStyleSchema(),
  },
});

export const defaultBehavior = {
  name: 'ProcessLogBtn',
  selector: (node) => node.props['x-component'] === 'ProcessLogBtn',
  extends: ['Field'],
  designerLocales: LocaleProcessLogBtn,
  designerProps: { propsSchema },
};

export const defaultResource = {
  icon: 'ProcessLog',
  elements: [
    {
      componentName: 'Field',
      props: {
        type: 'void',
        'x-decorator': 'Container',
        'x-decorator-props': {
          clickable: true,
        },
        'x-component': 'ProcessLogBtn',
        'x-component-props': defaultProps,
      },
    },
  ],
};
